﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using ConstructionBidOnline.Biz;
using ConstructionBidOnline.DAL;
using ConstructionBidOnline.DAL.dsRegisteredUserTableAdapters;

public partial class ConsultantSearchResult : System.Web.UI.Page
{

    #region Public Variables

    public dsRegisteredUser.SearchConsultantDataTable ConsultantTableForPaging = new dsRegisteredUser.SearchConsultantDataTable();
    public dsRegisteredUser.SearchConsultantDataTable ConsultantTablePerPage = new dsRegisteredUser.SearchConsultantDataTable();
    public ProfileImages profileimageObj;

    #endregion

    #region Event Handlers

    #region Page Load

    protected void Page_Load(object sender, EventArgs e)
    {
        string Keyword = (Request.QueryString["Keyword"] != null) ? Request.QueryString["Keyword"].ToString() : "";
        int Page = (Request.QueryString["Page"] != null) ? Int32.Parse(Request.QueryString["Page"].ToString()) : 1;
        string State = (Request.QueryString["State"] != null) ? Request.QueryString["State"].ToString() : "";
        string City = (Request.QueryString["City"] != null) ? Request.QueryString["City"].ToString() : "";
        string address = (Request.QueryString["st"] != null) ? Request.QueryString["st"].ToString() : " ";
        SearchConsultantTableAdapter adapter = new SearchConsultantTableAdapter();
        adapter.Connection = AppSettings.GetDbConn();
        if (Keyword != null)
        {
            ConsultantTablePerPage = adapter.GetData(Keyword, Page * 10);
        }
        else
        {
            if ((State != "") || (City != "") || (address != " "))
            {
                ConsultantTablePerPage = adapter.GetDataByLocation(State, City, address, Page * 10);
            }
            else
            {
                ConsultantTablePerPage = adapter.GetDataByNoCriteria(Page * 10);
            }
        }
    }

    #endregion

    #endregion
}
